package com.GPT.common;

import lombok.Data;

@Data
public class Result {
    private Object data;
    private Integer code;
    private String msg;

    public Result() {
    }

//    public Result(Integer code,Object data) {
//        this.data = data;
//        this.code = code;
//    }

    public Result(Integer code, Object data, String msg) {
        this.data = data;
        this.code = code;
        this.msg = msg;
    }
    public static Result msg(String msg) {
        Result r = new Result();
        r.data = null;
        r.code = 200;
        r.msg = msg;
        return r;
    }
    public static Result success(Object data, String msg) {
        Result r = new Result();
        r.data = data;
        r.code = 200;
        r.msg=msg;
        return r;
    }


    public static Result error(String msg) {
        Result r = new Result();
        r.msg = msg;
        r.code = 400;
        return r;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
